<?php htmlTemplate('admin_header_frame.php');?>
	<table width="100%" cellspacing="1" cellpadding="3" id="listTable">
	<tr>
		<td colspan="6"><form action="">&nbsp;&nbsp;
		
		栏目：<select name="columns" id="columns">
				<?php 
				if ($_GET['columns']){
					echo '<option value="'.$_GET['columns'].'">'.$_GET['cname'].'</option>';
				}
				?>
				<option value="0">全部</option>
				<?php foreach ($columns as $key=>$value):?>
				<option value="<?php echo $value['id'];?>"><?php echo $value['cname'];?></option>
				<?php 
				if(@$value['child']){
					foreach ($value['child'] as $k=>$v):?>
					<option value="<?php echo $v['id']?>">|----<?php echo $v['cname']?></option>
					<?php endforeach;
				}?>	
				<?php endforeach;?>
				</select>
		创建者：<input type="text" style="width:70px;"  name="createby" value="<?php if(Http::get('createby')) echo Http::get('createby');?>">	
		时间：<input 
				id="createSTime" 
				name="createSTime" 
				type="text" 
				style="width:65px;"
				value='<?php 
				if (Http::get('createSTime')){
					echo Http::get('createSTime');
				}
				?>' class='date demo_time'  
				onClick="WdatePicker({skin:'whyGreen',dateFmt:'yyyy-MM-dd'})"
				>-<input 
				id="createETime" 
				name="createETime" 
				type="text" 
				style="width:65px;"
				value='<?php 				 
				if (Http::get('createETime')){
					echo Http::get('createETime');
				}
				?>' class='date demo_time'  
				onClick="WdatePicker({skin:'whyGreen',dateFmt:'yyyy-MM-dd'})"
				>
		名称：<input type="text" name="title" style="width:200px;" value="<?php if(Http::get('title')) echo Http::get('title');?>">
		<input type="submit" value="搜 索"  class="submit"/>
		</form>
		</td>
	</tr>
	<tr >
			<th width="30">&nbsp;&nbsp;<input type="checkbox" onclick="checkAllBox(this);">
			</th>
			<th align="left"> 名称
			</th>
			<th align="left">&nbsp;&nbsp; 创建者
			</th>
			<th align="left">&nbsp;&nbsp; 创建时间
			</th>			
			<th align="left">&nbsp;&nbsp; 点击数
			</th>
			
			
			<th align="right">操作&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
			</th>
			
	</tr>
	<?php foreach ($rs['list'] as $key=>$value ):?>	
		
		<tr>
			<td>&nbsp;&nbsp;<input type="checkbox" class="checkitem" value="<?php echo $value['id'];?>">
			</td>
			<td align="left">&nbsp;&nbsp;
			<?php echo '['.$value['cname'].'] '.$value['title'].'';?>
			<?php 
				if ($value['thumb']){
					echo '&nbsp;<img src = "'.MVC_WWW_HOST.'img/thumb.gif" />';
				}
			?>
			</td>
			<td align="left">&nbsp;&nbsp; <?php echo $value['createby'];?>
			</td>
			<td align="left">&nbsp;&nbsp; <?php echo date("Y-m-d H:i:s",$value['createTime']);?>
			</td>
			<td align="left">&nbsp;&nbsp; <?php echo $value['hits'];?>
			</td>
			<td align="right">
			<a title="打开地址" href="<?php echo $value['url'];?>" target="_blank"><img  src="<?php echo MVC_WWW_HOST.'img/view.gif'?>" /></a>
			<a title="修改" href="<?php echo MVC_WWW_HOST.'admin/news/modify/id/'.$value['id'];?>"><img  src="<?php echo MVC_WWW_HOST.'img/edit.gif'?>" /></a>
			<a title="删除" href="javascript:;"><img onclick="getUrl('<?php echo MVC_WWW_HOST.'admin/news/del/id/'.$value['id'];?>',1,1)"  src="<?php echo MVC_WWW_HOST.'img/delete.gif'?>" /></a>
			&nbsp;&nbsp;&nbsp;&nbsp;</td>
		</tr>	
	<?php endforeach;?>
	
	<tr style="background: #F4FAFB;">
			<td align="left" colspan="6">
			<div style="float:left">
			&nbsp;&nbsp;&nbsp;<input type="button" value="转移到栏目" onclick="openColumns();"/>  
			<input type="button" value="所选文章生成静态" onclick="htmlNews();"/> 
			<input type="button" value="全部文章生成静态" onclick="htmlAllNews();"/> 
					
			<input type="button" value="删除" onclick="delItems();"/> <br>
			<div id="Columnspos" style="display: none;">
				&nbsp;&nbsp;&nbsp;<select name="columnss" id="columnss">
				<?php foreach ($columns as $key=>$value):?>
				<option value="<?php echo $value['id'];?>"><?php echo $value['cname'];?></option>
				<?php 
				if(@$value['child']){
					foreach ($value['child'] as $k=>$v):?>
					<option value="<?php echo $v['id']?>">|----<?php echo $v['cname']?></option>
					<?php endforeach;
				}?>	
				<?php endforeach;?>
				</select>
				<input type="button" value="转移" onclick="toColums();"/>
			</div>
			</div>
			<div style="float:right"><?php echo $rs['html'];?>&nbsp;&nbsp;&nbsp;&nbsp;</div>
			</td>
	</tr>
	</table>
</body>
</html>
<script>
var openToColumns = false;
var wwwHost = '<?php echo MVC_WWW_HOST;?>';
function openColumns(){
	if(openToColumns==false){
		$("#Columnspos").show('fast');
		openToColumns = true;
	}else{
		$("#Columnspos").hide('fast');
		openToColumns = false;
	}
	
	//getUrl(url);
}
function toColums()
{
	var items = getCheckItems();
	var columns = $("#columnss").val();
	if(!items){
		parent.showAlert('请选择要转移的文章！');
		return false;
	}
	var cateName = $("select[name='columnss']").find("option:selected").text();
//	alert(items);
	var url = wwwHost+'admin/news/tocolumns/columnsid/'+columns+'/id/'+items;
	
	getUrl(url,1,1,'确认要将所选的文章转移到【'+cateName+'】');
}
function  delItems()
{
	var items = getCheckItems();
	if(!items){
		parent.showAlert('请选择要删除文章！');
		return false;
	}
	var url = wwwHost+'admin/news/del/id/'+items;
	getUrl(url,1,1);
}
function htmlNews(){
	var items = getCheckItems();
	if(!items){
		parent.showAlert('请选择要生成的文章！');
		return false;
	}
	parent.$("#error").html('正在生成请稍候....');
	var url = wwwHost+'news/articlecreate/?id='+items;
	$.getJSON(url,function(rt){
		showMsg(rt.html);
	})
}
function htmlAllNews()
{
	var url = wwwHost+'news/articlecreate/?id=all';
	parent.$("#error").html('正在生成请稍候....');
	$.getJSON(url,function(rt){
		showMsg(rt.html);
			
	})
}

</script>